# 定义任务，就是定义函数
from celery_tasks.sms.yuntongxun.ccp_sms import CCP
from . import constants
from celery_tasks.main import celery_app


# 使用装饰器装饰celery,保证识别celery任务
@celery_app.task(name='send_sms_code')
def send_sms_code(mobile,sms_code):
    """
    定义发送短信的函数
    :param mobile: mobile
    :param sms_code:
    :return: 0 或者-1
    """

    send_ret = CCP().send_template_sms( mobile, [sms_code, constants.IMAGE_CODE_REDIS_EXPIRES // 60], constants.SEND_SMS_TEMPLATE_ID )
    return send_ret


